package software_construction.OOProject.d5_ploymorphic;

public class Master {
    public void feed(Pet pet){
        pet.eat();
    }

    public void play(Pet pet){
        if(pet instanceof  Dog){
            Dog dog=(Dog) pet;
            dog.playDisk();
        }else if(pet instanceof  Cat){
            Cat cat =(Cat) pet;
            cat.playBall();
        }
    }

    public Pet getPet(int type){
        Pet pet=null;
        if(type == 1){
            pet = new Dog();
        }else if(type == 2) {
            pet = new Cat();
        }
            return pet;
    }
}
